/** @file  get_gender.c
 *  @brief Get the gender detail
 * 
 *  To get the number from the user
 *   
 *  @author Karthik M 
 *  @bug No  bugs.
 */


#include "header.h"

int get_enum (char *line)
{
   int num ;

read_input:												//! do untill get valid number 
   if (fgets (line, LINEMAX,stdin) == NULL)
      exit (2);

   line [strlen (line) - 1] = '\0';					//! remove new line append null 

   if (valid_no (line) == 0){							//! check number is valid 
         printf ("enter the valid OPTION!!!!!!!!\n");
         goto read_input;
   }
   else  if ( (num = atoi(line)) > 2){
         printf ("enter the valid OPTION!!!!!!!!\n");
         goto read_input;
      }

   return num;								//! return the number on success 

}
